<?php

	session_start();

	require_once("appconf.php");
	require_once("lib/utility.php");
	require_once("lib/class.Template.php");

	if(!isset($_SESSION['username'])) {
		header("HTTP/1.1 401 Unauthorized");
		die();
	}


	//Read XML Data
	$xmlData =  file_get_contents("php://input");

	//Have report object write to file
	$templateObj = new Template($_SESSION['username']);
	$templateObj->forceXmlData($xmlData);
	$templateObj->writeTemplate();

?>